<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<%--
    Document   : blank
    Created on : 25.03.2010, 19:33:27
    Author     : Cyclone
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<body>
    <%--<script src="js/jquery.tablesorter.min.js" type="text/javascript"></script>--%>
    <script src="js/courses.js" type="text/javascript"></script>

    <%@include file="systemMessage.jsp" %>

    <div id="box" class="rounded-divcascade">
        <div id="rightnow">
            <h3 class="reallynow">
                <span>
                    Дополнительное свойство
                </span>
                <!--<a class="app_add" href="#addUser">Добавить пользователя</a>-->
                <br/>
            </h3>
        </div>

        <form id="form" action="EditProperty" method="post" class="rounded-formcascade">
            <fieldset>
                <legend>Общее</legend>
                <label>ID свойства : </label>
                <input  type="text" name="propertyId" readonly="readonly" value="${property.idAdditionalProperty}">

                <br/>
                <label for="type">Тип свойства : </label>
                <c:choose><c:when test="${!empty propertyTypeList}">
                        <select name="propertyType" ${!sessionScope.roles.admin ? 'disabled="disabled"' : ''}>
                            <c:forEach items="${propertyTypeList}" var="type">
                                <c:choose><c:when test="${property.propertyType.idPropertyType != type.idPropertyType}">
                                        <option value="${type.idPropertyType}">
                                            ${type.name}
                                        </option>
                                    </c:when><c:otherwise>
                                        <option value="${type.idPropertyType}" selected="selected">
                                            ${type.name}
                                        </option>
                                    </c:otherwise>
                                </c:choose>
                            </c:forEach>
                        </select>
                    </c:when><c:otherwise>
                        <input type="text"
                               tabindex="1" value="${fn:escapeXml(property.propertyType.name)}" readonly="readonly" />
                    </c:otherwise>
                </c:choose>

                <label for="title">Название : </label>
                <c:choose><c:when test="${sessionScope.roles.admin}">
                        <input name="title" type="text"
                               tabindex="1" value="${fn:escapeXml(property.name)}" />
                    </c:when><c:otherwise>
                        <input type="text"
                               tabindex="1" value="${fn:escapeXml(property.name)}" readonly="readonly" />
                    </c:otherwise>
                </c:choose>
                <br />

                <label for="valueNeeded">Требуется значение : </label>
                <c:choose><c:when test="${sessionScope.roles.admin}">
                        <c:set var="vn" value="${property.valueNeeded}"/>
                        <c:choose>
                            <c:when test="${vn == true}">
                                <c:set var="vn" value="checked=\"checked\""/>
                            </c:when><c:otherwise>
                                <c:set var="vn" value=""/>
                            </c:otherwise>
                        </c:choose>
                        <input type="checkbox" name="valueNeeded" <%= pageContext.getAttribute("vn")%> style="width: auto"/>
                    </c:when><c:otherwise>
                        <input type="checkbox" name="valueNeeded" <%= pageContext.getAttribute("vn")%> style="width: auto" disabled="disabled"/>
                    </c:otherwise>
                </c:choose>
                <br/>

                <label for="alias">
                    Псевдоним :
                </label>
                <c:choose><c:when test="${sessionScope.roles.admin}">
                        <input type="text" name="alias" value="${property.alias}"/>
                    </c:when><c:otherwise>
                        <input type="text" readonly="readonly" value="${property.alias}"/>
                    </c:otherwise></c:choose>

                    <label for="description">Описание : </label>
                <c:choose><c:when test="${sessionScope.roles.admin}">
                        <textarea id="textAreaDescription" name="description" tabindex="4" style="height: 50px;" onmouseover="textAreaFocus();" onmouseout="textAreaBlur();">${property.description}</textarea>
                    </c:when><c:otherwise>
                        <textarea id="textAreaDescription" readonly="readonly" tabindex="4" style="height: 50px;" onmouseover="textAreaFocus();" onmouseout="textAreaBlur();">${property.description}</textarea>
                    </c:otherwise></c:choose>

                    
                <%--
                                <c:if test="${sessionScope.roles.admin || sessionScope.roles.tutor}">
                                    <p align="center">
                                        <a href="SignStudents?courseId=${course.id}"><input style="width: 33%" type="button" value="Списки студентов"></a>
                                        <c:if test="${sessionScope.roles.admin}">
                                            <a href="SignTutors?courseId=${course.id}"><input  style="width: 33%" type="button" value="Списки тьюторов"></a>
                                            <input  style="width: 33%" type="button" value="Удалить курс" onclick="deleteCourse(${course.id}, event, '${fn:escapeXml(course.title)}');" style="width: 25%;"/>
                                        </c:if>
                                    </p>
                                </c:if>
                --%>
            </fieldset>


            <div align="center">
                <c:if test="${sessionScope.roles.admin}">
                    <input id="button1" type="submit" tabindex="20" value="Сохранить" />
                    <input id="button2" type="reset" tabindex="21" value="Отменить" /> <!-- onclick="window.location.reload();" />-->
                    <br />
                </c:if>

            </div>

        </form>
    </div>

    <script type="text/javascript">
        $(document).ready(function(){
            $("#liConfig").addClass("current");
            $('div#top-panel p').text('Редактирование дополнительного свойства');
        });
    </script>

</body>

